﻿using System.ComponentModel.DataAnnotations;

namespace homework3.Models
{
	public class Book
	{
		public int Id { get; set; }

		[StringLength(20,MinimumLength = 1,ErrorMessage ="书名至少一个字")]
		[Required(ErrorMessage ="书名必填")]
        [Display(Name="书名")]
		public string Title { get; set; }

		[Required(ErrorMessage ="作者必填")]
		[Display(Name ="作者")]
		public string Author { get; set; }

        [Required(ErrorMessage = "出版社必填")]
        [Display(Name ="出版社")]
		public string Publisher { get; set; }

        [Required(ErrorMessage = "出版时间必填")]
        [Display(Name ="出版时间")]
		[DataType(DataType.Date)]
		public string PublishingTime { get; set; }

		[Range(1,999,ErrorMessage ="1-999之间")]
        [Required(ErrorMessage = "价格必填")]
        [Display(Name ="价格")]
		[DataType(DataType.Currency)]
		public int Price {  get; set; }
	}
}
